package com.spark.incoicings.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spark.incoicings.dao.OrderMapper;
import com.spark.incoicings.service.OrderService;
import com.spark.incoicings.vo.PurchaseOrderVO;
import com.spark.invoicings.entity.Order;
import com.spark.invoicings.utils.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {

    @Resource
    private OrderMapper orderMapper;
    @Override
    public List<PurchaseOrderVO> selectCount() {
        List<PurchaseOrderVO> purchaseOrderVOS = orderMapper.selectCount();
        return purchaseOrderVOS;
    }

    /**
     * 统计应付总金额
     * @return
     */
    @Override
    public Result selectPendingAmount() {
        Integer pendingAmount = orderMapper.selectPendingAmount();
        return Result.success(200,"success",pendingAmount);
    }

    /**
     * 采购在途情况
     * @return
     */
    @Override
    public Result selectSourcing() {
        PurchaseOrderVO sourcing = orderMapper.selectSourcing();
        return Result.success(200,"success",sourcing);
    }
}
